package dto

import (
	"tuowei.com/app/admin/models"
	"tuowei.com/common/dto"
	common "tuowei.com/common/models"
)

type SysIndexCategoryConfigGetPageReq struct {
	dto.Pagination `search:"-"`
	Name           string `form:"name" search:"type:contains;column:name;table:sys_index_category_config" comment:"配置名称"`
}

type SysIndexCategoryConfigOrder struct {
	IdOrder        int    `search:"type:order;column:id;table:sys_index_category_config" form:"id_sort"`
	IsTopOrder     int    `search:"type:order;column:is_top;table:sys_index_category_config" form:"is_top_sort"`
	CreatedAtOrder string `search:"type:order;column:created_at;table:sys_index_category_config" form:"created_at_sort"`
	UpdatedAtOrder string `search:"type:order;column:updated_at;table:sys_index_category_config" form:"updated_at_sort"`
}

func (m *SysIndexCategoryConfigGetPageReq) GetNeedSearch() interface{} {
	return *m
}

type SysIndexCategoryConfigInsertReq struct {
	Id        int    `json:"id" comment:"主键ID"`
	Name      string `json:"name" comment:"分类名称"`
	PageLimit int    `json:"page_limit" comment:"该分类首页展示数据条数"`
	Sort      int    `json:"sort" comment:"排序"`
	IsShow    int    `json:"is_show" comment:"是否展示 -1-不展示 1-展示"`
	common.ControlBy
}

func (s *SysIndexCategoryConfigInsertReq) Generate(model *models.SysIndexCategoryConfig) {
	//model.CourseId = s.CourseId
	model.Name = s.Name
	model.PageLimit = s.PageLimit
	model.IsShow = s.IsShow
	model.Sort = s.Sort
	model.CreateBy = s.CreateBy
	model.Creator = s.Creator
}

func (s *SysIndexCategoryConfigInsertReq) GetId() interface{} {
	return s.Id
}

type SysIndexCategoryConfigUpdateReq struct {
	Id        int    `json:"id" comment:"主键ID" vd:"$>0; msg:'需要更新的ID不能为空'"`
	Name      string `json:"name" comment:"分类名称"`
	PageLimit int    `json:"page_limit" comment:"该分类首页展示数据条数"`
	Sort      int    `json:"sort" comment:"排序"`
	IsShow    int    `json:"is_show" comment:"是否展示 -1-不展示 1-展示"`
	common.ControlBy
}

func (s *SysIndexCategoryConfigUpdateReq) Generate(model *models.SysIndexCategoryConfig) {
	if s.Id != 0 {
		model.Id = s.Id
	}
	model.Name = s.Name
	model.PageLimit = s.PageLimit
	model.IsShow = s.IsShow
	model.Sort = s.Sort
	model.UpdateBy = s.UpdateBy
	model.Updater = s.Updater
}

func (s *SysIndexCategoryConfigUpdateReq) GetId() interface{} {
	return s.Id
}

type SysIndexCategoryConfigById struct {
	dto.ObjectById
	common.ControlBy
}

type SysIndexCategoryConfigUpdateTopStatusReq struct {
	Id     int `json:"id" comment:"更新ID" vd:"$>0; msg:'更新ID不能为空'"`
	IsShow int `json:"is_show" comment:"APP是否展示状态"`
	common.ControlBy
}

func (s *SysIndexCategoryConfigUpdateTopStatusReq) Generate(model *models.SysIndexCategoryConfig) {
	if s.Id != 0 {
		model.Id = s.Id
	}
	model.UpdateBy = s.UpdateBy
	model.Updater = s.Updater
}

type SysIndexCategoryConfigSearchReq struct {
	Name string `form:"name" search:"type:contains;column:name;table:sys_class" comment:"根据班主任名称搜索关键字"`
}

func (m *SysIndexCategoryConfigSearchReq) GetNeedSearch() interface{} {
	return *m
}
